package com.hwn.datax.component;

import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ChangeListener;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wnhuang
 * @date 2024/6/8 2:24
 */
public class MySimpleIntegerProperty extends SimpleIntegerProperty {

    private final List<ChangeListener<? super Number>> myListeners = new ArrayList<>();

    @Override
    public void addListener(ChangeListener<? super Number> changeListener) {
        super.addListener(changeListener);
        myListeners.add(changeListener);
    }


    public void removeAllMyListeners() {
        myListeners.forEach(this::removeListener);
        myListeners.clear();
    }
}
